﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Xml;

namespace VTNT.Framework.Service
{
    public class CXML
    {
        public static string GetXmlNodeValue(string xmlString, string nodeName)
        {

            if (string.IsNullOrEmpty(xmlString))
            {
                return null;
            }
            XmlDocument doc = new XmlDocument();

            try
            {
                doc.LoadXml(xmlString);
                XmlNodeList nodelist = doc.ChildNodes;
                if (nodelist.Count > 0 && nodelist[0].Attributes.Count > 0)
                {
                    return nodelist[0].Attributes[nodeName].Value;
                }
                return null;
            }
            catch
            {
                return null;
            }
            finally
            {
                doc = null;
            }
        }
    }
}